﻿using SYJ.Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SYJ.IDAL
{
   public partial interface IBaseDal<T> where T:class ,new ()
    {
        
       /// <summary>
       /// 添加
       /// </summary>
       /// <param name="t"></param>
       /// <returns></returns>
       int Insert(T t);
       /// <summary>
       /// 批量添加
       /// </summary>
       /// <param name="list"></param>
       /// <returns></returns>
       int Insert(List<T> list);
       /// <summary>
       /// 修改
       /// </summary>
       /// <param name="t"></param>
       /// <returns></returns>
       bool Update(T t);
       /// <summary>
       /// 批量修改
       /// </summary>
       /// <param name="list"></param>
       /// <returns></returns>
       bool Update(List<T> list);
       /// <summary>
       /// 删除
       /// </summary>
       /// <param name="t"></param>
       /// <returns></returns>
       bool Delete(T t);
       /// <summary>
       /// 批量删除
       /// </summary>
       /// <param name="list"></param>
       /// <returns></returns>
       bool Delete(List<T> list);

       /// <summary>
       /// ID获取实体
       /// </summary>
       /// <param name="id"></param>
       /// <returns></returns>
       T GetModel(int id);
       /// <summary>
       /// 获取全部记录
       /// </summary>
       /// <returns></returns>
       List<T> GetAll();
       /// <summary>
       /// 分页获取
       /// </summary>
       /// <param name="query"></param>
       /// <returns></returns>
       List<T> GetPage(QueryModel query, out long count);
       List<T> Get(string sql);
       List<T> Get(string sql, object param);

       T GetModel(string sql);

       T GetModel(string sql, object param);
    }
}
